class Consulta
  

  protected
  def self.conditions
    [conditions_clauses.join(' AND '), *conditions_options]
  end

  def self.conditions_clauses
    conditions_parts.map {|condition| condition.first}
  end

  def self.conditions_options
    conditions_parts.map {|condition| condition[1..-1]}.flatten
  end

  def self.conditions_parts
    methods.grep(/_conditions$/).map {|m| send(m)}.compact
  end
end
